Start centralizing IDLs to reduce duplication and errors Fixes #5339 (or rather, starts to). We had two copies of the DOM IDL, one in dom/ and one in html/, which were out of sync. Additionally, tons of tests copy bits and pieces of IDLs from specs like DOM, or define stubs, instead of properly including the whole IDL. These should be fixed to include the whole IDL, because some tests may need to know about the entire base interface (e.g., testing that objects inherit properly). I chose to make the IDLs centralized because we might want to process them centrally in the future. For instance, we could have a script to update all of them, or a test that checks for non-standard properties on the global object and imports all the IDLs to get a list of standard properties. These seem easier to do if the IDLs are all in one place.
diff --git a/XMLHttpRequest/interfaces.html b/XMLHttpRequest/interfaces.html index 96de3c0..56ba552 100644 --- a/XMLHttpRequest/interfaces.html +++ b/XMLHttpRequest/interfaces.html
@@ -10,46 +10,6 @@ <div id=log></div> <script type=text/plain class=untested> -[Constructor(DOMString type, optional EventInit eventInitDict)/*, - Exposed=(Window,Worker)*/] -interface Event { - readonly attribute DOMString type; - readonly attribute EventTarget? target; - readonly attribute EventTarget? currentTarget; - - const unsigned short NONE = 0; - const unsigned short CAPTURING_PHASE = 1; - const unsigned short AT_TARGET = 2; - const unsigned short BUBBLING_PHASE = 3; - readonly attribute unsigned short eventPhase; - - void stopPropagation(); - void stopImmediatePropagation(); - - readonly attribute boolean bubbles; - readonly attribute boolean cancelable; - void preventDefault(); - readonly attribute boolean defaultPrevented; - - [Unforgeable] readonly attribute boolean isTrusted; - readonly attribute DOMTimeStamp timeStamp; - - void initEvent(DOMString type, boolean bubbles, boolean cancelable); -}; - -dictionary EventInit { - boolean bubbles = false; - boolean cancelable = false; -}; - -/*[Exposed=(Window,Worker)]*/ -interface EventTarget { - void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false); - void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false); - boolean dispatchEvent(Event event); -}; -</script> -<script type=text/plain class=untested> [TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event); typedef EventHandlerNonNull? EventHandler; @@ -149,11 +109,11 @@ </script> <script> "use strict"; -var form; -var idlArray; -setup(function() { - form = document.createElement("form"); - idlArray = new IdlArray(); +var form = document.createElement("form"); +var idlArray = new IdlArray(); + +function doTest(domIdl) { + idlArray.add_untested_idls(domIdl); [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) { if (node.className == "untested") { idlArray.add_untested_idls(node.textContent); @@ -166,6 +126,11 @@ XMLHttpRequestUpload: ['(new XMLHttpRequest()).upload'], FormData: ['new FormData()', 'new FormData(form)'] }); -}); -idlArray.test(); + idlArray.test(); +} + +promise_test(function() { + return fetch("/interfaces/dom.idl").then(response => response.text()) + .then(doTest); +}, "Test driver"); </script>